
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>DataType.Date.parse()</title>

<style type="text/css">
/*margin and padding on body element
  can introduce errors in determining
  element position and are not recommended;
  we turn them off as a foundation for YUI
  CSS treatments. */
body {
	margin:0;
	padding:0;
}
</style>

<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
<script type="text/javascript" src="../../build/yui/yui-min.js"></script>


<!--begin custom header content for this example-->
<style type="text/css">
/* custom styles for this example */
#demo .output {margin-bottom:1em; padding:10px; border:1px solid #D9D9D9;}
</style>

<!--end custom header content for this example-->

</head>

<body class="yui3-skin-sam  yui-skin-sam">

<h1>DataType.Date.parse()</h1>

<div class="exampleIntro">
	The Date module of the DataType Utility allows you to take a data value and convert it to a number. The <code>parse()</code> method will accept <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Date">any value supported by JavaScript's <code>Date()</code> constructor</a>.
			
</div>

<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->

<form id="demo">
    <fieldset>
        <label for="demo_input">String to parse:</label>
        <input type="text" id="demo_input" value="Jan 7, 2003">
        <input type="submit" id="demo_btn" value="Parse date">
        <div id="demo_output" class="output"></div>
    </fieldset>
</form>



<script type="text/javascript">
YUI().use("node", "datatype-date", function (Y) {
    Y.on("submit", function(e){
        e.halt();
        
        var input = Y.one("#demo_input").get("value"),
            output = Y.DataType.Date.parse(input);
                
        if(output === null) {
            output = "null"
        }
        
        Y.one("#demo_output").setContent(output.toString());
    }, "#demo");
});
</script>

<!--END SOURCE CODE FOR EXAMPLE =============================== -->

</body>
</html>
